#include "server.h"
#include "sys_linux.h"

#include <syslog.h>

/* Change this to whatever your daemon is called */
#define DAEMON_NAME "mydaemon"

/* Change this to the user under which to run */
#define RUN_AS_USER "jdu"

int main(int argc, char *argv[])
{
    // initialize the logging interface
    openlog(DAEMON_NAME, LOG_PID, LOG_LOCAL5);
    syslog(LOG_INFO, "starting");
    daemonize("/var/lock/" DAEMON_NAME, RUN_AS_USER);

    int ret = startServer(argc, argv);
    syslog(LOG_NOTICE, "terminated");
    closelog();
    return ret;
}
